package org.amicofragile.simpledsl;

import org.amicofragile.simpledsl.Optimizer1;

import groovy.util.GroovyTestCase;

class Optimizer3Test extends GroovyTestCase {
	public void testFoo() {
		def processedList = Optimizer3.withCriteria({it % 2 == 0 ? 'even' : 'odd'}) {
			odd{it.inject(1) { acc, val -> acc * val }}
			even{it.sort()}
		}.process([1, 3, 6, 4, 10, 2, 5, 3])

		assertArrayEquals([3, 2, 4, 6, 10, 15].toArray(), processedList.toArray())
	}
}
